package com.itgungnir.diyshuo.base;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;

/**
 * 所有Activity的基类
 */
public abstract class BaseActivity extends AppCompatActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayoutId());
    }

    /**
     * 抽象方法，获取当前Activity的布局文件ID
     */
    public abstract int getLayoutId();

    /**
     * 弹出Toast
     */
    public void popToast(String text) {
        Toast.makeText(this, text, Toast.LENGTH_SHORT).show();
    }
}